package com.dl.controller;

import com.dl.pojo.CourseChoose;
import com.dl.pojo.Teacher;
import com.dl.service.CourseChooseService;
import com.dl.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class CourseChooseController {

    @Autowired
    private CourseChooseService courseChooseService;

    @RequestMapping("/imit_coursechoose.action")
    public ModelAndView imit_coursechoose(ModelAndView mav){
        List<CourseChoose> courseChooses= courseChooseService.imitCourseChoose();
        if (courseChooses.isEmpty()){
            //failed
            mav.setViewName("fail.jsp");
        }else{
            mav.addObject("courseChooses",courseChooses);
            mav.setViewName("showCoursechooses.jsp");
        }
        return mav;
    }
}
